#ifndef CIOPS_OP_CREATECYLINDER_H
#define CIOPS_OP_CREATECYLINDER_H

#include <strstream>

#include "Operation.h"

namespace CIOps {
    /**
     * This class represents the operation of creation of a cylinder   
     **/
    class OP_CreateCylinder : public Operation {    

    public:            
        OP_CreateCylinder (std::vector<CIView::View*>& v);      //Constructor
        virtual ~OP_CreateCylinder();                           //Destructor

    protected:
        CIGeom::Geometry* cylinder;             //A pointer to the cylinder that will be added in the 3D scene
        CICore::Point topLeft;                  //The cylinder top left bounding box coordinate
        float height;                           //The cylinder height  
        float radius;                           //The cylinder radius

        int stacks;                             //The number of stacks (for the cylinder subdivision in faces)
        int slices;                             //The number of slices (for the cylinder subdivision in faces)

        float rotation_x;                       //The cylinder x axis orientation

        short cylinderDetail;                   //The cylinder tessellation detail

        //Methods for Triangles Tessellation of a cylinder
        void CreateCylinderWithTriangles (int stacks, int slices, float height, float radius);
        void AddFace (int v1, int v2, int v3);               

    public:            
        //Utility Methods
        virtual int Exec();         //Method called to execute directly the operation
        virtual void Undo();        //Method called to undo the operation
        virtual void Redo();        //Method called to redo the operation

        virtual void MousePressEvent (CIView::View* view, QMouseEvent* e);        //Mouse Pressed event handler
        virtual void MouseReleaseEvent (CIView::View* view, QMouseEvent* e);      //Mouse Released event handler
        virtual void MouseMoveEvent (CIView::View* view, QMouseEvent* e);         //Mouse Moved event handler
        virtual void WheelEvent (CIView::View* view, QWheelEvent* e);             //Wheel event handler
    };
}

#endif /* CIOPS_OP_CREATECYLINDER_H */
